package com.blrs.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.blrs.service.supplier.IHonorManagementTeacherService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.blrs.common.annotation.Log;
import com.blrs.common.core.controller.BaseController;
import com.blrs.common.core.domain.AjaxResult;
import com.blrs.common.enums.BusinessType;
import com.blrs.domain.HonorManagementTeacher;
import com.blrs.common.utils.poi.ExcelUtil;
import com.blrs.common.core.page.TableDataInfo;

/**
 * 师资管理荣誉资质信息Controller
 * 
 * @author ruoyi
 * @date 2025-02-18
 */
@RestController
@RequestMapping("/teacherHonor/teacherHonor")
public class HonorManagementTeacherController extends BaseController
{
    @Autowired
    private IHonorManagementTeacherService honorManagementTeacherService;

    /**
     * 查询师资管理荣誉资质信息列表
     */
    @GetMapping("/list")
    public TableDataInfo list(HonorManagementTeacher honorManagementTeacher)
    {
        startPage();
        List<HonorManagementTeacher> list = honorManagementTeacherService.selectHonorManagementTeacherList(honorManagementTeacher);
        return getDataTable(list);
    }

    /**
     * 导出师资管理荣誉资质信息列表
     */
    @Log(title = "师资管理荣誉资质信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, HonorManagementTeacher honorManagementTeacher)
    {
        List<HonorManagementTeacher> list = honorManagementTeacherService.selectHonorManagementTeacherList(honorManagementTeacher);
        ExcelUtil<HonorManagementTeacher> util = new ExcelUtil<HonorManagementTeacher>(HonorManagementTeacher.class);
        util.exportExcel(response, list, "师资管理荣誉资质信息数据");
    }

    /**
     * 获取师资管理荣誉资质信息详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(honorManagementTeacherService.selectHonorManagementTeacherById(id));
    }

    /**
     * 新增师资管理荣誉资质信息
     */
    @Log(title = "师资管理荣誉资质信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody HonorManagementTeacher honorManagementTeacher) throws Exception
    {
        return toAjax(honorManagementTeacherService.insertHonorManagementTeacher(honorManagementTeacher));
    }

    /**
     * 修改师资管理荣誉资质信息
     */
    @Log(title = "师资管理荣誉资质信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody HonorManagementTeacher honorManagementTeacher)
    {
        return toAjax(honorManagementTeacherService.updateHonorManagementTeacher(honorManagementTeacher));
    }

    /**
     * 删除师资管理荣誉资质信息
     */
    @Log(title = "师资管理荣誉资质信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(honorManagementTeacherService.deleteHonorManagementTeacherByIds(ids));
    }


}
